# @Time : 2020/7/28 13:56
# @Author : Fioman 
# @Phone : 13149920693
import cv2 as cv
import numpy as np


"""
Laplacian(拉普拉斯)算子是一种二阶导数算子,具有旋转不变性,可以满足不同方向的图像边缘锐化(边缘检测)的要求.
通常情况下,其算子的系数之和需要为零.例如,一个3*3大小的Laplacian算子如下图所示:
0   1   0
1   -4  1
0   1   0
Laplacian 算子类似二阶Sobel导数,需要计算两个方向的梯度值.例如:在图9-25所示:
dst = cv.Laplacian(src,ddepth,ksize,scale,delta,borderType)
"""

img = cv.imread("test.bmp",cv.IMREAD_GRAYSCALE)
laplacian = cv.Laplacian(img,cv.CV_64F)
laplacian = cv.convertScaleAbs(laplacian)

cv.imshow("Original",img)
cv.imshow("Laplacian",laplacian)
cv.waitKey(0)
cv.destroyAllWindows()